home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug173 / abc.lxi next >
Text File  |  1979-12-31  |  624b  |  26 lines

  1. /*
  2.  * An example lex input file to show the effects of quotes,
  3.  * apostrophes, and upper and lower case letters.
  4.  */
  5.  
  6. c = [C];
  7.  
  8. %{
  9. main()
  10. {
  11.     int token_number;
  12.     while(token_number = yylex())
  13.         printf("\nyylex returns %d\n", token_number);
  14.     printf("\nyylex returns NULL\n");
  15. }
  16. %}
  17.  
  18. %%
  19. 'a'            {printf("yylex: a\n");   return(1);}
  20. 'A'            {printf("yylex: A\n");   return(2);}
  21. "b"            {printf("yylex: b\n");   return(3);}
  22. "B"            {printf("yylex: B\n");   return(4);}
  23. C            {printf("yylex: c\n");   return(5);}
  24. c            {printf("yylex: C\n");   return(6);}
  25. [\n\r\t ]    {printf("yylex: white space\n"); return(LEXSKIP);}
  26. %%